package com.xssn.fjnd.feign;



import com.xssn.fjnd.entities.SysMenu;
import com.xssn.fjnd.entities.SysUser;
import com.xssn.fjnd.feign.req.WxUserInfoREQ;
import com.xssn.util.base.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

// 远程调用xssn-system微服务中的接口
@FeignClient(value = "xssn-system-server", path = "/system")
public interface IFeignSystemController {

    @ApiImplicitParam(name = "username", value = "用户名", required = true)
    @ApiOperation("Feign接口-通过用户名查询用户信息")
    @GetMapping("/api/feign/user/{username}")
    SysUser findUserByUsername(@PathVariable("username") String username);

    @ApiImplicitParam(name = "userId", value = "用户ID", required = true)
    @ApiOperation("Feign接口-通过用户ID查询拥有权限")
    @GetMapping("/api/feign/menu/{userId}")
    List<SysMenu> findMenuListByUserId(@PathVariable("userId") String userId);

    @ApiImplicitParam(name = "sysUser", value = "用户", required = true)
    @ApiOperation("Feign接口-微信新用户注册同时保留sys_user表")
    @GetMapping("/api/feign/user/saveUser")
    boolean saveUser(@RequestBody SysUser sysUser);

    @ApiOperation("Feign接口-更新sys_user中的用户信息")
    @PutMapping("/feign/user/updateUserInfo")
    Result updateUserInfo(@RequestBody WxUserInfoREQ wxreq);

}
